#include "StdAfx.h"
#include "Contact.h"
#include "ContactAttribute.h"

CContact::CContact(void)
:CBaseList("Contact")
{
	SetSubKeyName("Attribute");
}

CContact::~CContact(void)
{
}
CBaseElement* CContact::NewNode()
{
	return new CContactAttribute();
}
liveneo::tstring CContact::getWorkTele()
{
	m_sWorkTele=GetAttribute("worktel");
	return m_sWorkTele;
}
liveneo::tstring CContact::getHomeTele()
{
	m_sHomeTele = GetAttribute("hometel");
	return m_sHomeTele;
}
liveneo::tstring CContact::getMobile()
{
	m_sMobile = GetAttribute("mobile");
	return m_sMobile;
}
void CContact::setWorkTele(liveneo::tstring sWorkTele)
{
	m_sWorkTele=sWorkTele;
	SetAttribute("worktel",sWorkTele);
}
liveneo::tstring CContact::getHotContactFlag()
{
	m_sHotContactFlag=GetAttribute("ishot");
	return m_sHotContactFlag;
}
void CContact::setHotContactFlag(liveneo::tstring sFlag)
{
	m_sHotContactFlag=sFlag;
	SetAttribute("ishot",sFlag);
}
liveneo::tstring CContact::GetXMLText()
{
	ParseXMLNode();
	if (this->GetXMLNode()!=NULL)
    {
        const liveneo::tstring CONFMT="<%s name=\"%s\" caption=\"%s\" worktel=\"%s\" ishot=\"%s\">%s<%0:s/>";
		liveneo::tstring retstr;
		retstr=StringUtil::printf(CONFMT.c_str(),GetKeyName().c_str(),GetName().c_str(),GetCaption().c_str(),m_sWorkTele.c_str(),m_sHotContactFlag.c_str(),CBaseList::GetXMLText().c_str());
		//retstr.Format(CONFMT,this->GetKeyName(),this->GetName(),this->GetCaption(),m_csFieldFlag,m_csRecordFlag,m_csEndFlag,CBaseList::GetXMLText());
        return retstr;
    }
    return "";
}
liveneo::tstring CContact::getSubTele()
{
	m_sSubTele=GetAttribute("extension");
	return m_sSubTele;
}
void CContact::setSubTele(liveneo::tstring stele)
{
	m_sSubTele=stele;
	SetAttribute("extension",stele);
}